﻿#if !NETFX_CORE
using System.Windows;
using System.Windows.Controls.Primitives;

#endif
#if !(WINDOWS_PHONE || NETFX_CORE)
namespace Nx.Commands
{
    public class ControlClickCommandBehavior : CommandBehaviorBase<ButtonBase>
    {
        public ControlClickCommandBehavior(ButtonBase clickableObject)
            : base(clickableObject)
        {
            if (clickableObject == null)
            {
                throw new System.ArgumentNullException("clickableObject");
            }

            clickableObject.Click += OnClick;
        }

        private void OnClick(object sender, RoutedEventArgs e)
        {
            ExecuteCommand();
        }
    }
}
#endif